import HttpUtils from '../HttpUtils/HttpUtils';
// 获取当前时间戳
var timestamp = Date.parse(new Date()) / 1000;
Page({
	...HttpUtils.func,
	data: {
		meetId: '',
		iconList: [],
	},
	onLoad(params) {
		var meetId = params.meetId;
		this.setData({
			meetId: meetId
		});

		//支部会议总结接口(支部管理员接口)
		this.loadpartyMeetInfo();
	},



	//支部会议详情查询接口
	loadpartyMeetInfo: function() {
		var newUrl = getApp().globalData.dangjianUrl + "/party/partyMeetInfo";
 
		var params = {};
		params["meetId"] = this.data.meetId + "";
		params = JSON.stringify(params);
		this.httpGet(newUrl, params, "支部会议详情查询接口调用失败").then(
			(respData) => {
				var result = respData.data.result.code;
				if (1 == result) {
					var meet = respData.data.meet;
					var DateTime = this.formatDate('yyyy-MM-dd', meet.endDate);
					meet.DateTime = DateTime;
					var statusName;
					console.log(meet)
					this.setData({
						"partyMeetInfo": meet,
						"iconList": meet.iconList,
						"statusName": statusName
					});
				} else {
          this.showPageMsg("alert", respData.data.result.description)
				}

			}
		);
	},

	//支部会议总结接口(支部管理员接口)
	loadpartyMeetSumup: function() {
		var newUrl = getApp().globalData.dangjianUrl + "/party/partyMeetSumup";
		// var params = ',"meetId":"' + this.data.meetId + '","summary":"123","iconId":"",'
		// 	+ '"sign":"appKey=1&code=' + this.data.parentId + '&nonce=' + timestamp + '&siteCode=' + getApp().globalData.siteCode + '&timestamp=' + timestamp + '&appSecret=' + getApp().globalData.appSecret + '"}';
		var params = {};
		params["meetId"] = this.data.meetId + "";
		params["summary"] = "123456summary";
		params["iconId"] = "";
		params = JSON.stringify(params);
		this.httpGet(newUrl, params, "支部会议总结接口(支部管理员接口)调用失败").then(
			(respData) => {
				var result = respData.data.result.code;
				if (1 == result) {
					this.showPageMsg("tips", "支部会议总结接口(支部管理员接口)成功!");
				} else {
          this.showPageMsg("alert", respData.data.result.description)				}
			}
		);
	},

	onReachBottom() {
		// 页面被拉到底部
		// if (this.data.pageIndex > this.data.totalPages) {
		//   this.showPageMsg("tips","没有更多数据了!");
		// } else {
		//   this.loadMsg();
		// }
	},
	onPullDownRefresh: function() {
		// this.setData({
		//   pageIndex:1,
		//   msgList:[]
		// });
		// this.loadMsg();
		// wx.stopPullDownRefresh();
	}
});
